<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.25" charset="UTF-8">
    <title>Edit Item</title>
    <link rel="StyleSheet" href="/css/jpetstore.css" type="text/css" media="screen"/>
</head>
<body>
<header th:replace="common/top"></header>
<div id="Content">
    <h2 th:text="${item.itemId} != null ? 'Edit Item' : 'Add Item'"></h2>
    <form th:action="@{/catalog/saveItem}" th:object="${item}" method="post">

        <div th:if="${item.itemId} != null">
            <input type="text" th:field="*{itemId}"/>
<!--            <input  type="hidden"  th:field="*{itemId}">-->
        </div>
        <div th:if="${item.itemId} ==null">
            <label>iten id:</label>
            <input type="text" th:field="*{itemId}" />
        </div>

        <div>
            <label>Product ID:</label>
            <select th:field="*{productId}">
                <option value="" disabled="disabled" th:selected="*{productId} == null">请选择类别</option>
                <option th:each="product : ${products}"
                        th:value="${product.productId}"
                        th:text="${product.productId}"
                        th:selected="*{productId} == ${product.productId}">
                </option>
            </select>
<!--            <input type="text" th:field="*{productId}" />-->
        </div>
        <div>
            <label>List Price:</label>
            <input type="number" th:field="*{listPrice}" />
        </div>
        <div>
            <label>Attribute1:</label>
            <input type="text" th:field="*{attribute1}" />
        </div>
        <div>
            <label>Attribute2:</label>
            <input type="text" th:field="*{attribute2}" />
        </div>
        <div>
            <label>Supplier Id:</label>
            <input type="number" th:field="*{supplierId}">
        </div>
        <!-- 根据需要添加其他属性 -->
        <div>
            <button type="submit" >Save</button>
        </div>
    </form>
</div>
<footer th:replace="common/bottom"></footer>

<!--脚本-->
<script th:src="@{/js/background.js}" count="500"></script>
</body>
</html>

